<!DOCTYPE html>
<html lang="en">
<head>
	<link rel="stylesheet" href="../static/layui/css/layui.css">
	<script src="../static/layui/layui.js"></script>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Inventory Management System</title>
</head>
<body class="layui-layout-body">
	<div class="layui-layout layui-layout-admin">
		<div class="layui-header">
            <div class="layui-logo "><i class="layui-icon layui-icon-cart"></i>Inventory Management</div>
            <!-- Header area (can be used with the existing horizontal navigation of layui) -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item" ><a href="/index/"><i class="layui-icon layui-icon-table"></i>Goods Management</a></li>
                <li class="layui-nav-item"><a href="/count/"><i class="layui-icon layui-icon-rmb"></i>Budget statistics</a></li>
                <li class="layui-nav-item"><a href="/other/"><i class="layui-icon layui-icon-time"></i>Stock Records</a></li>
                <li class="layui-nav-item"><a href="/notifications/"><i class="layui-icon layui-icon-notice"></i>Notification</a></li>
                {% if session.get('role') == 'super_admin' %}
                <li class="layui-nav-item"><a href="/admin/manage_users"><i class="layui-icon layui-icon-set"></i>Manage Users</a></li>
                {% endif %}
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item">
                    <a href="/logout" class="layui-btn layui-btn-danger">Logout</a>
                </li>
            </ul>
        </div>

		<div style="padding: 5%;">
			<!-- 内容主体区域 -->
			<table class="layui-hide" id="record"></table>
			<script type="text/html" id="toolbarDemo"></script>
		</div>
	</div>
	<script>

		layui.use('table', function () {
			var table = layui.table;
			table.render({
				elem: '#record'
				, url:'/data/records/'
				, toolbar: '#toolbarDemo' // Enable header toolbar and bind it to the left template
                , defaultToolbar: ['filter', 'exports', 'print'] // Default toolbar buttons
                , title: 'Transaction Records' // Table title
                , cols: [[
                    {
                      field: 'time',
                      title: 'Time',
                      width: 160,
                      fixed: 'left',
                      sort: true,
                      templet: function(d) {
                        return layui.util.toDateString(d.time); // Keep original date formatting
                      }
                    },
                    { field: 'name', title: 'Product Name', width: 200, sort: true },
                    { field: 'model', title: 'Model', width: 200, sort: true },
                    { field: 'factory', title: 'Manufacturer', width: 200, sort: true },
                    { field: 'process', title: 'Purpose', width: 100, sort: true },
                    { field: 'inorout', title: 'In/Out', width: 100, sort: true },
                    { field: 'change', title: 'Quantity', width: 150 },
                    { field: 'people', title: 'Operator', width: 150 }
                    ]]

				, page: true
                ,limit:50
                ,skin: 'row'
                ,even: true
                ,height: 'full-120'
			});
		});

	</script>

</body>
</html>
